﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using YWTSSys.Library;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using YWTSSys.Model;
namespace YWTSSys.DAL
{
    public class ConsumeRecordDAL
    {
        public static int Add(ConsumeRecordInfo obj)
        {
            Database DB = DatabaseFactory.CreateDatabase();

            DbCommand dbCommand = DB.GetStoredProcCommand("ConsumeRecord_Add", obj.客户ID, obj.消费金额, obj.获的积分, obj.UserId, obj.RealName, obj.备注说明);
            return Convert.ToInt32(DB.ExecuteScalar(dbCommand));
        }

        public static DataTable GetByCustomerId(int 客户ID)
        {
            Database DB = DatabaseFactory.CreateDatabase();

            DbCommand dbCommand = DB.GetStoredProcCommand("ConsumeRecord_GetByCustomerId", 客户ID);
            return DB.ExecuteDataSet(dbCommand).Tables[0];
        }
    }
}
